package com.qf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.bean.Position;
import com.qf.dao.PositionMapper;
import com.qf.service.PositionService;
import com.qf.utils.constant.PageUils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 1/12/2019
 * Echo
 * qmxc
 * Alibaba
 */
@Service
public class PositionServiceImpl implements PositionService {
    @Autowired
    private PositionMapper positionMapper;
    @Override
    public PageInfo<Position> getAll(Integer index,Position position) {
        PageHelper.startPage(index, PageUils.PAGESIZE.getSize());
        List<Position> positionList=positionMapper.getAll(position);
        for (Position position1 : positionList) {
            System.out.println(position1+"55555555555555555555");
        }
        PageInfo<Position> positionPageInfo = new PageInfo(positionList);
        return positionPageInfo;
    }

    @Override
    public Integer add(Position position) {
      Integer i=  positionMapper.add(position);
      return i;
    }

    @Override
    public Integer delete(Integer pid) {
       Integer i= positionMapper.delete(pid);
       return i;

    }

    @Override
    public Position showBack(Integer pid) {
       Position position= positionMapper.showBack(pid);
       return position;
    }

    @Override
    public Integer update(Position position) {
       Integer i= positionMapper.update(position);
       return i;
    }
}
